/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Items;

import ElementsProperties.ActivableOnCollision;
import Actors.Actor;
import Actors.HumanControlledBall;
import ElementsProperties.ActorEntranceSensible;
import Model.CollisionEvent;
import ElementsProperties.Buyable;


/**
 *
 * @author vf
 */

public class Coin extends Item implements ActivableOnCollision,ActorEntranceSensible{



    @Override
    public void setImage() {
        itemImage=EnigmaUtils.ImageLoader.loadImage("./images/it-coin1.png");
    }


    public void collisionOccured(CollisionEvent e) {
        if(e.getCase().getStone() instanceof Buyable){
            Buyable buyable = (Buyable) e.getCase().getStone();
            if(buyable.buy()) inventory.removeItem(this);
        }
    }

    public void collected() {
    }

    @Override
    public void update(long dtime) {
    }

    public boolean isCollectable() {
        return true;
    }

    public void actorEnters(Actor a) {
        if(a instanceof HumanControlledBall)
            goToInventory();
    }

    public void actorLeaves(Actor a) {
    }

}
